class xT_AICommand_Act_DefendPoint extends xT_AICommand_Act;

//=============================================================================
// Variables: Defending
//=============================================================================
var private vector      mDefendPoint;

//=============================================================================
// State
//=============================================================================
AUTO state DefendPoint
{
	function LookAround()
	{
		local Rotator lnewRotation;
		if (Pawn != none)
		{
			lnewRotation = RotRand(false);
			ClampRotation(lnewRotation, lnewRotation, Rot(0,0,0), Rot(0,8192,0));
			lnewRotation.Pitch = Pawn.Rotation.Pitch;
			lnewRotation.Roll = Pawn.Rotation.Roll;
			SetDesiredRotation(lnewRotation);
		}		
	}

	function bool IsInDefendLocation()
	{
		return (Pawn.Location == mDefendPoint);
	}

Begin:
	//`log("xT_AICommand_DefendPoint executed");
	mDefendPoint = Pawn.Location;

WatchGuarding:
	LookAround();
	if (!IsInDefendLocation()) xT_AIController(Outer).MoveToPosition(mDefendPoint, true, true);
	CheckForEnemyReported();
	Sleep(WorldInfo.DeltaSeconds * 5);
	Goto('WatchGuarding');

Defending:

Ending:

}

//=============================================================================
// DefaultProperties
//=============================================================================
defaultproperties
{
}
